Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

384
Vistas
Socket.io throw connect_error "server error" after moving to a different domain name

This is the extension of my last question here:

socket.io always has connection false

For now, I have two servers deployed in two different domain names. The first server works perfectly fine with socket.io, so I redeployed the server to the new domain name by simply pull the same branch from GitHub, install everything and run it. And then I found that all my socket.io connections failed and the symptom is exactly the same as last time: connection always 'false' and disconnection always 'true'.

This time I am pretty sure it is not related with cors, because I tried io.origins((origin, cb) => if (whitelist.includes(origin)) { cb(null, true) } else { cb('failed', false) ) and it shows the origin is allowed.

I also tried cors: { origin: '*' } and that also doesn't work.

Strangely, despite the fact that they are using the same code, connecting to the first domain name works perfectly fine. But the second one has the issue.

UPDATE:

I use this to track the error message.

        this.socket.on('connect_error', function(err) {
            console.log(`connect_error due to ${err.message}`);
        });

And this is what is returned:

connect_error due to server error

In the mean time, on server side I can see nothing other than the new connections being created and being disconnected due to ping timeout.

Where can I find more information to help me debug?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Turns out I forgot to run npm i after deploying to a new domain name. The version of socket.io wasn't updated and caused that issue.

Everyone who sees this, just make sure you have updated the package before you give up on debugging.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda